package cn.itlaobing.service.impl;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itlaobing.entity.Employee;
import cn.itlaobing.mapper.EmployeeMapper;
import cn.itlaobing.service.EmployeeService;
@Service
public class EmployeeServiceImpl implements EmployeeService {
	@Autowired
	private EmployeeMapper employeeMapper;
	@Transactional
	@Override
	public Employee save(Employee employee) {
		employeeMapper.insert(employee);
		return employee;
	}
	@Transactional
	@Override
	public List<Employee> findAll() {
		List<Employee> list=employeeMapper.findAll();
		return  list;
	}
	@Override
	public Employee quiryById(Integer empno) {
		Employee employee=employeeMapper.selectByPrimaryKey(empno);
		return  employee; 
	}
	@Override
	public Employee updateData(Employee employee) {
		employeeMapper.updateByPrimaryKey(employee);
		return employee;
	}
	@Override
	public int deleteData(Integer empno) {
		
		return employeeMapper.deleteByPrimaryKey(empno);
	}
	
}
